import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// import './plugins/print.js'
import Print from './plugins/print'

Vue.use(Print)
import store from "./store";
import './assets/global.css'
//   import Print from 'vue-print-nb'
//
//   Vue.use(Print);  //注册

import ZkTable from 'vue-table-with-tree-grid'

Vue.component('tree-table', ZkTable)
Vue.filter('dateFormat', function (val) {
    let dt = new Date(val)
    let y = dt.getFullYear()
    let m = (dt.getMonth() + 1 + '').padStart(2, '0')
    let d = (dt.getDate() + '').padStart(2, 0)
    let hh = (dt.getHours() + '').padStart(2, 0)
    let mm = (dt.getMinutes() + '').padStart(2, 0)
    let ss = (dt.getSeconds() + '').padStart(2, 0)
    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
Vue.filter('dateFormatYMH', function (val) {
    let dt = new Date(val)
    let y = dt.getFullYear()
    let m = (dt.getMonth() + 1 + '').padStart(2, '0')
    let d = (dt.getDate() + '').padStart(2, 0)
    return `${y}-${m}-${d}`
})
import BaseUrl from '../settings'
import axios from 'axios'
// axios.defaults.baseURL = 'http://42.193.3.21/api/private/v1/'
// axios.defaults.baseURL = 'http://127.0.0.1/api/private/v1/'
axios.defaults.baseURL = BaseUrl.baseURL
axios.interceptors.request.use(config => {

    //请求前添加Token
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
})
Vue.prototype.$http = axios
Vue.config.productionTip = false
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
